package personnel.department.dao.entity;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang3.time.DateUtils;

@Entity
@Table(name="qualification")
public class Qualification  implements UniqueObject {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id")
	private Long id;

	@Column(name="organization")
	private String organization;

	@Column(name="name_cycle")
	private String nameCycle;

	@Column(name="where_completed")
	private String whereCompleted;

	@Column(name="hours")
	private Integer hours;

	@Column(name="date_testing")
	private Date dateTesting;

	@Column(name="number_certificate")
	private Integer numberCertificate;

	@Column(name="start_education")
	private Date startEducation;

	@Column(name="finish_education")
	private Date finishEducation;

	@Column(name="first_qualification")
	private Boolean firstQualification;
	
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="employee_Id")
	private Employee employee;

	public Qualification(List<Object> params) {
		this.organization = (String) params.get(0);
		this.nameCycle = (String) params.get(1);
		this.whereCompleted = (String) params.get(2);
		this.hours = Integer.parseInt((String) params.get(3));
		this.dateTesting = (Date) params.get(4);
		this.numberCertificate = Integer.parseInt((String) params.get(5));
		this.startEducation = (Date) params.get(6);
		this.finishEducation = (Date)  params.get(7);
		this.firstQualification = (Boolean) params.get(8);
	}

	public Qualification() {
	}

	public Long getId() {
		return id;
	}

	public String getOrganization() {
		return organization;
	}

	public String getNameCycle() {
		return nameCycle;
	}

	public Integer getHours() {
		return hours;
	}

	public Date getDateTesting() {
		return dateTesting;
	}

	public Integer getNumberCertificate() {
		return numberCertificate;
	}


	public Boolean getFirstQualification() {
		return firstQualification;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setOrganization(String organization) {
		this.organization = organization;
	}

	public void setNameCycle(String nameCycle) {
		this.nameCycle = nameCycle;
	}

	public void setHours(Integer hours) {
		this.hours = hours;
	}

	public void setDateTesting(Date dateTesting) {
		this.dateTesting = dateTesting;
	}

	public void setNumberCertificate(Integer numberCertificate) {
		this.numberCertificate = numberCertificate;
	}

	public void setFirstQualification(Boolean firstQualification) {
		this.firstQualification = firstQualification;
	}

	public String getWhereCompleted() {
		return whereCompleted;
	}

	public Date getStartEducation() {
		return startEducation;
	}

	public Date getFinishEducation() {
		return finishEducation;
	}

	public void setWhereCompleted(String whereCompleted) {
		this.whereCompleted = whereCompleted;
	}

	public void setStartEducation(Date startEducation) {
		this.startEducation = startEducation;
	}

	public void setFinishEducation(Date finishEducation) {
		this.finishEducation = finishEducation;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

}